package com.ec.system.api.modules.sys.feign.factory;

import com.ec.system.api.modules.sys.feign.ISysUserFeign;
import com.ec.system.api.modules.sys.feign.fallback.SysUserFeignFallback;
import org.springframework.cloud.openfeign.FallbackFactory;

/**
 * @description: 回调工厂方法可以捕获熔断异常
 * @author: Eric Lee
 * @time: 2021/6/24 17:05
 */
public class SysUserFeignFallbackFactory implements FallbackFactory<ISysUserFeign> {
    @Override
    public SysUserFeignFallback create(Throwable throwable) {
        SysUserFeignFallback sysUserClientFallback = new SysUserFeignFallback();
        sysUserClientFallback.setThrowable(throwable);
        return sysUserClientFallback;
    }
}
